cmake_minimum_required(VERSION 3.17)
project(LibeventDemo C)

set(CMAKE_C_STANDARD 11)

if (CMAKE_HOST_WIN32)
    set(WINDOWS 1)
elseif (CMAKE_HOST_APPLE)
    set(MACOS 1)
elseif (CMAKE_HOST_UNIX)
    set(LINUX 1)
endif ()

aux_source_directory(./ SRC)

IF (WINDOWS)
    message(WINDOWS)
    SET(LIBEVENT_DIR D:/clib/libevent)
    include_directories(${LIBEVENT_DIR}/include)
    link_directories(${LIBEVENT_DIR}/lib)
    link_libraries(wsock32 ws2_32 Iphlpapi)
ELSEIF(LINUX)
    message(LINUX)
    # 引入zlog 日志
    link_directories(/usr/local/lib)
    link_libraries(zlog pthread)
ENDIF ()


link_libraries(libevent.a libevent_core.a libevent_extra.a )

add_executable(${PROJECT_NAME} ${SRC})



#aux_source_directory(controllers CTL_SRC)
#target_sources(${PROJECT_NAME} PRIVATE ${CTL_SRC})